const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : '0' + n
} 

module.exports = {
  formatTime: formatTime,
  clickListItemAndJump: clickListItemAndJump,
  clickAlbumItemAndJump: clickAlbumItemAndJump
}

  

/*** 详情跳转 */
function clickListItemAndJump (event) {
  var articleId = event.currentTarget.dataset.postad;

  console.log(articleId);

  wx.navigateTo({
    //url: 'post-detail/post-detail' //跳转详情页 切记配置app.json文件
    url: '/pages/detail/detail?id=' + articleId //传递参数
  })
}

function clickAlbumItemAndJump(event) {
  var albumId = event.currentTarget.dataset.postad;

  console.log(albumId);

  wx.navigateTo({
    //url: 'post-detail/post-detail' //跳转详情页 切记配置app.json文件
    url: '/pages/albumdetail/albumdetail?id=' + albumId //传递参数
  })
}